var t = getApp();

Component({
  properties: {
    navColor: {
      type: String,
      value: "rgba(0,0,0,1)"
    },
    textColor:{
      type: String,
      value: "#424752"
    },
    city: {
      type: String,
      value: ""
    },
    title: {
      type: String,
      value: ""
    },
    point: {
      type: String,
      value: ""
    },
    labelName: {
      type: String,
      value: ""
    },
    imageUrl: {
      type: String,
      value: ""
    },
    imageIcon: {
      type: Boolean,
      value: !1
    },
    showNavBar: {
      type: Boolean,
      value: !0
    },
    showHome: {
      type: Boolean,
      value: !1
    },
    showBack: {
      type: Boolean,
      value: !1
    },
    back_type: {
      type: Number,
      value: 1
    },
    showBack_to: {
      type: Boolean,
      value: !1
    },
    showAgain: {
      type: Boolean,
      value: !1
    },
    showMy: {
      type: Boolean,
      value: !1
    },
    showTime: {
      type: Boolean,
      value: !1
    },
    showBack_tec: {
      type: Boolean,
      value: !1
    },
    showBack_my: {
      type: Boolean,
      value: !1
    },
  },
  data: {
    homeTop: 18,
    titleFontSize: 36,
    titleFontWeight: 500,
    navBarTop: 0,
    titleTop: 20,
    capsuleHeight: 44,
    statusBarHeight: null,
    pixelRate: null,
    width: 87,
    height: 32
  },
  ready: function() {
    var e = wx.getSystemInfoSync(),o = wx.getMenuButtonBoundingClientRect();
    var pixelRate = e.windowWidth / 750, statusBarHeight = e.statusBarHeight;
    t.globalData.navHeight = (statusBarHeight + this.data.capsuleHeight) / pixelRate;
    if(statusBarHeight >= 44){
      t.globalData.isIphoneX = true
    }
    this.setData({
      statusBarHeight: statusBarHeight,
      pixelRate: pixelRate,
      width: o.width,
      height: o.height
    })
  },
  methods: {
    tapNavBack: function() {
      var type=this.properties.back_type;
      if(type==1){
        wx.navigateBack({
          delta: 1,
          success:function(){},
          fail:function(res){
            wx.switchTab({
              url: '../../pages/home/home',
            })
          }
        });
      }else{
        wx.switchTab({
          url: '../../pages/home/home',
        })
      }
    },
    tapNavBack_to: function(){
      var showAgain = this.properties.showAgain;
      if(showAgain){
        var index = 1
        this.triggerEvent('checkAgain', {index})
      }else{
        wx.navigateBack({
          delta: 1,
          success:function(){},
          fail:function(res){
            wx.switchTab({
              url: '../../pages/home/home',
            })
          }
        });
      }
    },
    nav_search: function(){
      wx.navigateTo({
        url: '../../pages/search/search',
      })
    },
    nav_city:function(){
      wx.navigateTo({
        url: '../../pages/cityList/cityList?city='+this.properties.city,
      })
    }
  },
});